﻿using System;
using Core.Interfaces;
using System.Windows.Forms;
using Core.Unity;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace MainUI
{
    static class Program
    {
        /// <summary>
        /// Главная точка входа для приложения.
        /// </summary>
        [STAThread]
        static void Main()
        {
            var container = new UnityContainer();
            container.LoadConfiguration("MyConfig");
            var server_url = System.Environment.MachineName + @"\SQLEXPRESS";
            var user = System.Environment.MachineName + @"\" + System.Environment.UserName;
            IConnection connection = container.Resolve<IConnection>(new ResolverOverride[]
                                   {
                                       new ParameterOverride("serverUrl", server_url),
                                       new ParameterOverride("databaseName", "buildings"),
                                       new ParameterOverride("user", user),
                                       new ParameterOverride("password", "1234")
                                   });
            ResolverContainer.Resolver = container;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}
